<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type = "text/javascript" src = "https://d3js.org/d3.v4.min.js"></script>
</head>

<body>
    <ul id="list">
        <li></li>
        <li></li>
    </ul>
    <input type="button" name="remove" value="Remove fourth value" onclick="javascript:remove()" />

    <script>
        d3.select("#list").selectAll("li").data([10, 20, 30, 25, 15]).text(function (d) { return d }).enter().append("li").text(function(d){return d})
        // 删除
        function remove(){
            d3.selectAll("li").data([10, 20]).exit().remove()
        }
    </script>
</body>

</html>